#include <stdio.h>
#include <math.h>

void main(){
	int n,j=1,k=1,i=0,flag=-1,ni=1;
	scanf("%d", &n);
	int o[n][n];
	int *pk=&o[0][n-1];
	for ( j=1;j<=n*n;j++ ){	
		*pk=j;
		i++;
		if (i==k){
			if ( k==n ){
				ni=-1;
				flag*=-1;
			}
			if (flag==-1){
				pk--;
				k=k+1*ni;
				flag=flag*-1;
			}else if (flag==1){
				pk+=n;
				k=k+1*ni;
				flag=flag*-1;
			}
			i=0;
		}else{
			pk+=ni*flag*(n+1);
		}
	}
	pk = &o[0][0];
	for ( j=0;j<n*n;j++ ){
		printf("%d ", *pk++);	
	}
}

